package net.bluemind.unixsocket;

import java.io.IOException;

import net.bluemind.unixsocket.impl.SocketAPI;

public class UnixClientSocket {

	private int fd;
	private SocketAPI impl;
	private String path;

	public UnixClientSocket(String path) throws IOException {
		this.path = path;
		this.impl = new SocketAPI();
		fd = impl.allocateSocket();
	}

	public UnixDomainSocketChannel connect() throws IOException {
		return impl.connect(fd, path);
	}
	
	public void close() throws IOException {
		impl.close(fd);
	}

}
